#include <bits/stdc++.h>
using namespace std;

using llt = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using pll = pair<llt, llt>;

struct Point {
    llt x;
    llt y;
    Point(llt a, llt b):x(a),y(b){}
    llt cross(const Point & r) const {
        return x * r.y - y * r.x;
    }
    const Point operator - (const Point & r) const {
        return {x - r.x, y - r.y};
    }
};

int N;
llt A, B, C;
vector<llt> S;
vector<llt> D;
vector<int> Q;

const Point get(int p){
    return {S[p], S[p] * (B - A * S[p]) - D[p]};
}

void work(){
    cin >> N >> A >> B >> C;
    S.assign(N + 1, 0);
    for(int a,i=1;i<=N;++i){
        cin >> a;
        S[i] = S[i - 1] + a;
    }

    D.assign(N + 1, 0);
    Q.assign(N + 10, 0);
    int * bot = Q.data();
    int * top = bot;
    for(int i=1;i<=N;++i){
        const Point now(1, -A * (S[i] +  S[i]));
        while(bot < top and now.cross(get(*(bot + 1)) - get(*bot)) <= 0){
            bot += 1;
        }

        auto tmp = S[i] - S[*bot];
        D[i] = D[*bot] + ((A * tmp + B) * tmp) + C;

        while(bot < top and (get(*top) - get(*(top - 1))).cross(get(i) - get(*top)) <= 0){
            top -= 1;
        }
        *++top = i;
    }
    cout << D[N] << "\n";
    return;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int nofkase = 1;
    // cin >> nofkase;
    while(nofkase--) work();
    return 0;
}
